package com.java0108;

import com.java1228.S;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Test03 {
}
class Server03{
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(8282);

        while (true){
            Socket socket = serverSocket.accept();//接收客服端发送的请求，类型是Socket
            InputStream inputStream = socket.getInputStream();
            byte[] arr = new byte[1024];
            int len = inputStream.read(arr);
            System.out.println(new String(arr, 0, len));
        }
    }

}
class Client03{
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("192.168.1.150",8282);
        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("你是".getBytes());
    }

}